| Conditions | 2 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 27 | |||
| 28 | @Post() |
||
| 29 | @Roles(UserRole.COOPERATOR, UserRole.EMPLOYEE) |
||
| 30 | @ApiOperation({summary: 'Create new customer'}) |
||
| 31 | public async index(@Body() customerDto: CustomerDTO) { |
||
| 32 | const { |
||
| 33 | address: {street, city, zipCode, country}, |
||
| 34 | name |
||
| 35 | } = customerDto; |
||
| 36 | |||
| 37 | try { |
||
| 38 | const id = await this.commandBus.execute( |
||
| 39 | new CreateCustomerCommand(name, street, city, zipCode, country) |
||
| 40 | ); |
||
| 41 | |||
| 42 | return {id}; |
||
| 43 | } catch (e) { |
||
| 44 | throw new BadRequestException(e.message); |
||
| 45 | } |
||
| 48 |